#include "common/pch.h"
#include "metadata/player_create_info.h"

#include <cftf/loger/syslog.h>
#include <cftc/reflect/class.h>
#include <cftc/reflect/field.h>
#include <cftc/util/sysutils.h>

namespace mt
{

	CFT_IMPLEMENT_REFLECT_CLASS_BEGIN(PlayerCreateInfo, cftc::reflect::Object);
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(mapId, R"(wow_meta:"field_name:map")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(areaId, R"(wow_meta:"field_name:zone")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(positionX, R"(wow_meta:"field_name:position_x")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(positionY, R"(wow_meta:"field_name:position_y")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(positionZ, R"(wow_meta:"field_name:position_z")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(orientation, R"(wow_meta:"field_name:orientation")");

		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(race, R"(wow_meta:"field_name:race")");
		CFT_IMPLEMENT_REFLECT_FIELD_ANNOTATION(_class, R"(wow_meta:"field_name:class")");
	CFT_IMPLEMENT_REFLECT_CLASS_END();

	void PlayerCreateInfo::GetPlayerClassLevelInfo(unsigned int race, unsigned int class_, PlayerClassLevelInfo* class_info)
	{
#if 0
		if (level < 1 || class_ >= MAX_CLASSES)
		{
			return;
		}
#endif
	}

	void PlayerCreateInfo::GetPlayerLevelInfo(unsigned int race, unsigned int _class, unsigned int level, PlayerLevelInfo* info)
	{

	}

	void PlayerCreateInfo::MetaInstanceInit1()
	{
		race_class_hash_[cftc::util::MakeInt64(race, _class)] = this;
	}

	const PlayerCreateInfo* PlayerCreateInfo::GetByRaceClass(unsigned int race, unsigned int _class)
	{
		auto itr = race_class_hash_.find(cftc::util::MakeInt64(race, _class));
		return itr != race_class_hash_.end() ? itr->second : nullptr;
	}

}